package com.merugu.school.mail;

import javax.mail.*;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import java.util.Properties;

/**
 * Created by IntelliJ IDEA.
 * User: raveendramerugu
 * Date: 12/19/10
 * Time: 7:53 PM
 * To change this template use File | Settings | File Templates.
 */
public class MailUtil {


    public static void sendMail(String from, String to, String subject, String msg) throws NoSuchProviderException {


        GmailUtils mailUtils = new GmailUtils();
        mailUtils.setUserPass("reddy.raveendra", "nature");
        try {
            mailUtils.connect();
            mailUtils.sendMessage("reddy.raveendra@gmail.com", "reddy.raveendra@gmail.com", "Welcome", "Welcome");
        } catch (Exception e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
    }
}
